package cn.doitedu.rtmk.demo8.model_inject;

import cn.doitedu.rtmk.demo8.RuleCalculator;

import java.io.IOException;

public class CodeInstanceTest {

    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException {
        String code = "package cn.doitedu.rtmk.demo8.model_inject;\n" +
                "\n" +
                "import cn.doitedu.rtmk.common.EventBean;\n" +
                "import cn.doitedu.rtmk.demo8.RuleCalculator;\n" +
                "import org.apache.flink.api.common.functions.RuntimeContext;\n" +
                "import org.apache.flink.util.Collector;\n" +
                "import org.roaringbitmap.longlong.Roaring64Bitmap;\n" +
                "\n" +
                "import java.io.IOException;\n" +
                "\n" +
                "public class DemoRuleModelCalculator implements RuleCalculator {\n" +
                "    @Override\n" +
                "    public void init(RuntimeContext runtimeContext, String ruleParamJsonStr, Roaring64Bitmap preSelectUsersBitmap) throws IOException {\n" +
                "        System.out.println(\"我被初始化\");\n" +
                "    }\n" +
                "\n" +
                "    @Override\n" +
                "    public void calc(EventBean eventBean, Collector<String> collector) throws IOException {\n" +
                "        System.out.println(\"我计算\");\n" +
                "    }\n" +
                "}";

        // 构造运算机模型的实例对象
        Class<?> aClass = Class.forName("cn.doitedu.rtmk.demo8.model_inject.DemoRuleModelCalculator");
        RuleCalculator ruleCalculator = (RuleCalculator) aClass.newInstance();
        ruleCalculator.init(null,null,null);


    }

}
